<?php
/**
 * Author: bluer
 * Date: 3/23/16
 */

// Master server
if (!defined('MASTER_DB_HOST')) define('MASTER_DB_HOST', '');
if (!defined('DB_USER')) define('DB_USER', '');
if (!defined('DB_PASS')) define('DB_PASS', '');

// Slave server
if (!defined('SLAVE_DB_HOST')) define('SLAVE_DB_HOST', '');


global $cmsdb, $uddb;

if (is_a($cmsdb, 'CMSDB')) {
    $cmsdb->addDatabase(array(
        'host'      =>  MASTER_DB_HOST,
        'user'      =>  DB_USER,
        'password'  =>  DB_PASS,
        'dbname'    =>  'educms',
        'write'     =>  1
    ));

    $cmsdb->addDatabase(array(
        'host'      =>  SLAVE_DB_HOST,
        'user'      =>  DB_USER,
        'password'  =>  DB_PASS,
        'dbname'    =>  'educms',
        'read'      =>  1
    ));
}

if (is_a($uddb, 'UDDB')) {
    $uddb->addDatabase(array(
        'host'      =>  MASTER_DB_HOST,
        'user'      =>  DB_USER,
        'password'  =>  DB_PASS,
        'dbname'    =>  'userdata',
        'write'     =>  1
    ));

    $uddb->addDatabase(array(
        'host'      =>  SLAVE_DB_HOST,
        'user'      =>  DB_USER,
        'password'  =>  DB_PASS,
        'dbname'    =>  'userdata',
        'read'      =>  1
    ));
}